﻿<?php

include("db_connection.php"); //db접속파일
global $connect;

$inputID   = $_REQUEST['userID'];
$inputName = $_REQUEST['userName'];
$inputMail = $_REQUEST['userMail'];
$inputPass = $_REQUEST['userPass'];
$inputRepa = $_REQUEST['userRepa'];
$inputInviter = $_REQUEST['userInviter'];
/*
$inputID   = 'adad';
$inputName = 'adad';
$inputMail = 'adad';
$inputPass = 'adad';
$inputRepa = 'adad';
$inputInviter = 'adad';
*/


$sql = "SELECT count(*) FROM login_info WHERE id ='$inputID';";
$i = mysql_query($sql, $connect);
$rec = mysql_fetch_array($i);
if($rec[0]=='1'){
    echo '1'; //중복아이디
    }else {
        if($inputPass==$inputRepa){
             $sql = "INSERT INTO login_info VALUES (null, '$inputID', '$inputName', '$inputMail', '$inputPass', '$inputInviter' );";
             mysql_query($sql, $connect);
             echo '0'; //실행
        } else {
             echo '2'; //패스워드 잘못입력
        }
    }

    /*
    INSERT INTO login_info ( no.,id,name,e-mail ,pw ,inviter )
    VALUES (NULL , 'abcd', 'kim', 'se@na.net', '1234', NULL );
    */


    ?>